<%@page import="com.lianjing.sh.spring.web.controller.enhance.operate.Util_Operate"%>
<%@page import="com.lianjing.sh.spring.web.controller.base.operate.OperateTarget"%>
<%@page import="com.lianjing.sh.spring.web.controller.base.operate.OperatableActionBean"%>
<%@page import="com.sh_lianjing.web.el.EL"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%-- 按钮样式 --%>
<c:set var="buttionStyle" value="btn btn-primary"/>
<%-- 功能 --%>
<c:forEach items="${operates}" var="operate">
<% OperatableActionBean operate = EL.eval("${operate}", OperatableActionBean.class, pageContext); %>
<c:set var="operateUrl" value="${operate.url}"/>
<c:if test="${operate.granted && operate.displaied}">

	<%-- disabled --%>
	<c:set var="disabled" value=""/>
	<c:if test="${operate.disabled}">
	<c:set var="disabled" value="disabled='disabled'"/>
	</c:if>
	<%-- S 弹出类型嵌入相关 --%>
	<c:if test='${operate.target == "Popup"}' >
		<c:set var="onclickString" value='onclick="fun_ReferrerType(this,true);embedsIsContainsOperate_fun(this, true)" src="${RootUrl}${operateUrl}"' />
	</c:if>
	<c:if test='${operate.target != "Popup"}' >
		<c:set var="onclickString" value='href="${RootUrl}${operateUrl}" onclick="fun_ReferrerType(this,false)" target="${operate.target.htmlName}"'/>
	</c:if>
	<c:if test="${operate.accessType=='WithData'}">
		<c:if test='${operate.target != "Popup"}' >
			<c:set var="onclickString" value='class="js_myForm" ${onclickString} '/>
		</c:if>
		<c:if test='${operate.target == "Popup"}' >
			<c:set var="onclickString" value='class="js_withData" ${onclickString} '/>
		</c:if>
	</c:if>
	<%-- E 弹出类型嵌入相关 --%>

	<%-- 导入Excel --%>
	<c:if test="${operate.actionType=='ExcelImport'}">
		<div class="${operate.operateId} btn-group tooltips" role="group" aria-label="..." data-toggle="tooltip" title="${operate.explain}" data-placement="top" ${disabled}
		 com="myDataSave" waitBar="window" access="${RootUrl}${operateUrl}" bindBeforeAction="@fun:fun_popup_confirm('确认导入数据?')" bindAfterAction="@fun:fireMyDataFind_forModule('')"
		>
			<button type="button" class="btn btn-primary" style="margin:0; padding:4.8px;">
     			<div class="xxh_btn_inputFile">
     				<input name="${operate.fileFieldName}" type="file" />
				</div>
            </button>        
			<button type="button" com-fire="myDataSave" class="btn btn-primary" >
				<span class="glyphicon glyphicon-import"></span> ${operate.comment}
			</button>
		</div>
	</c:if>
	
	<%-- 非导入Excel --%>
	<c:if test="${operate.actionType!='ExcelImport'}">
	<div class="${buttionStyle} tooltips" data-toggle="tooltip" title="${operate.explain}" data-placement="top" ${disabled} >

		<c:if test="${operate.accessType=='General' || operate.accessType=='WithData'}" var="accessTypeFlag">
			<c:if test="${operate.accessType=='General'}">
				<a ${onclickString} style="color: white;">
					<c:if test="${operate.actionType=='Add'}">
						<span class="fa fa-plus"></span>
					</c:if>
					<c:if test="${operate.actionType=='Edit'}">
						<span class="glyphicon glyphicon-edit"></span>
					</c:if>
					${operate.comment}
				</a>
			</c:if>
			<c:if test="${operate.accessType=='WithData'}">
				<span ${onclickString} coverAccess="${RootUrl}${operateUrl}" style="color: white;">
					<c:if test="${operate.actionType=='Add'}">
						<span class="fa fa-plus"></span>
					</c:if>
					<c:if test="${operate.actionType=='Edit'}">
						<span class="glyphicon glyphicon-edit"></span>
					</c:if>
					${operate.comment}
				</span>
			</c:if>
		</c:if>
		
		<c:if test="${!accessTypeFlag}">
		
			<%-- 删除(单个) --%>
			<c:if test="${operate.actionType=='Delete'}">
				<div com="myDataDelete" access="${RootUrl}${operateUrl}" waitBar="window" 
				 bindBeforeAction="@fun:fun_popup_confirm('确认删除?')"
				 bindAfterAction="@fun:fun_bindAfterAction('<%=OperateTarget.ReferrerOperateTargetParaName%>', '${operate.actionType}', '')" bindAfterTo="${RootUrl}<%=Util_Operate.returnTo(operate, request)%>"
				 defaultConfirmMessage="false" defaultSuccessMessage="false"
				>
					<a com-fire="myDataDelete" style="color: white;" >
						<span class="glyphicon glyphicon-remove"></span> ${operate.comment}
					</a>
				</div>
			</c:if>
			
			<%-- 删除(多个)-Page --%>
			<c:if test="${operate.actionType=='Deletes'}">
				<c:if test="${moduleType=='Page' || moduleType=='List'}" >
					<a class="js_dataDeletes_head" coverAccess="${RootUrl}${operateUrl}" style="color: white;" >
						<span class="glyphicon glyphicon-remove"></span> ${operate.comment}
					</a>
				</c:if>
			</c:if>
			
			<%-- 导出Excel--%>
			<c:if test="${operate.actionType=='ExcelExport'}">
				<%-- (单个)Page --%>
				<c:if test="${moduleType!='Page' && moduleType!='List'}" >
					<div com="myA" access="${RootUrl}${operateUrl}" 
					 bindBeforeAction="@fun:fun_popup_confirm('确认导出文件?')" bindAfterAction="@fun:fun_popup_message('')"
		 			>
		 				<a com-fire="myA" style="color: white;" >
							<span class="glyphicon glyphicon-export"></span> ${operate.comment}
						</a>
					</div>
				</c:if>
				<%-- (多个)Page --%>
				<c:if test="${moduleType=='Page' || moduleType=='List'}" >
					<a class="js_dataExcelExport_head" coverAccess="${RootUrl}${operateUrl}" style="color: white;">
						<span class="glyphicon glyphicon-export"></span> ${operate.comment}
					</a>
				</c:if>
			</c:if>
			
			<%-- 提交(多个)-Page --%>
			<c:if test="${operate.actionType=='Submits'}">
				<c:if test="${moduleType=='Page' || moduleType=='List'}" >
					<a class="js_dataSubmits_head" coverAccess="${RootUrl}${operateUrl}" style="color: white;" >
						<span class="glyphicon glyphicon-remove"></span> ${operate.comment}
					</a>
				</c:if>
			</c:if>
			
			<%-- 提交(单个) --%>
			<c:if test="${operate.actionType=='Get' || operate.actionType=='Submit'}">
				<div class="${operate.operateId}" com="myDataSubmit" access="${RootUrl}${operateUrl}" waitBar="window"
				 bindBeforeAction="@fun:fun_popup_confirm('确认操作?')"
				 bindAfterAction="@fun:fun_bindAfterAction('<%=OperateTarget.ReferrerOperateTargetParaName%>', '${operate.actionType}', '')"
				>
					<a com-fire="myDataSubmit" style="color: white;" coverBindAfterTo="${RootUrl}<%=Util_Operate.returnTo(operate, request)%>" style="color: white;" >
						<span></span> ${operate.comment}
					</a>
				</div>
			</c:if>
			
			<%-- 文件下载 --%>
			<c:if test="${operate.actionType=='FileDownload'}">
				<a href="${RootUrl}${operateUrl}" style="color: white;" >
					<span></span> ${operate.comment}
				</a>
			</c:if>
			
			<%-- 文件上传 --%>
			<c:if test="${operate.actionType=='FileUpload' || operate.actionType=='FilesUpload'}">
				<div class="${operate.operateId}" com="myDataSave" waitBar="window" access="${RootUrl}${operateUrl}" bindBeforeAction="@fun:fun_popup_confirm('确认上传文件?')" bindAfterAction="@fun:fireMyDataFind_forModule('')">
					<button com-fire="myDataSave" class="btn btn-primary">
						<span class="glyphicon glyphicon-import"></span> ${operate.comment}
					</button>
					<input name="${operate.fileFieldName}" type="file" <c:if test="${operate.actionType=='FilesUpload'}">multiple="multiple"</c:if> />
				</div>
			</c:if>
			
			<%-- 打印 
			<!-- <button type="button" class="btn btn-primary">
			<span class="glyphicon glyphicon-print"></span> 打印
			/button> -->
			--%>
			
			<%-- Websocket --%>
			<c:if test="${operate.actionType=='Message'}">
				<div class="${operate.operateId}" 
				 	com="myWebsocket" run="connect" sendAfterAction="@fun:fun_popup_process()" receiveAfterAction="@fun:fun_popup_process_receive()"
				>
					<a coverReceiveAccess="${operate.sendTo}" coverSendAccess="${RootUrl}${operateUrl}" com-fire="myWebsocket->send" style="color: white;" title="${operate.explain}" >
						${operate.comment}
					</a>
				</div>
			</c:if>
			
			<%-- 其它 --%>
			<c:if test="${operate.actionType=='Other'}">
				<a ${onclickString} style="color: white;">
					${operate.comment}
				</a>
			</c:if>
		</c:if>
	</div>
	</c:if>
	
</c:if>
</c:forEach>
<%-- E 功能  --%>